import React, { useRef, useState, useEffect } from 'react';
import { connect } from 'umi';
import TableDataBlock from '@/components/TableDataBlock';
import { reloadTab } from '@/utils/utils';
import { notification } from 'antd';
import { Button, Modal, Space, Form, Row, Col } from 'antd';
import { AdminType } from '@/common/contact';
import { } from '@/common/contact';
import FormCondition from '@/components/FormCondition';
import { useUpdateEffect } from 'ahooks';
const LookAdmin = (props) => {
    const {
        visible = false,
        onClose,
        loading,
        organizationAuthAdminList,
        dispatch,
        onChange,
    } = props;
    const { show = false, detail = {}, params = {} } = visible;

    const [selectedRowKeys, setSelectedRowKeys] = useState([])
    const childRef = useRef();
    const searchItems = [
        {
            label: '员工姓名',
            name: 'keyword',
        },
    ];

    const getColumns = [
        {
            title: '姓名',
            dataIndex: 'username',
        },
        {
            title: '岗位类型',
            dataIndex: 'adminType',
            render: (e) => {
                return AdminType[e];
            },
        },
        {
            title: '员工阶段',
            dataIndex: 'stageDesc',
        },
    ];
    const modalProps = {
        title: '查看员工',
        width: 900,
        visible: typeof visible === 'boolean' ? visible : show,
        maskClosable: true,
        destroyOnClose: true,
        zIndex: 1001,
        confirmLoading: loading,
        footer: null
    };

    return (
        <Modal {...modalProps} onCancel={onClose}>
            <TableDataBlock
                params={{
                    ...params,
                }}
                searchItems={searchItems}
                cRef={childRef}
                loading={loading}
                columns={getColumns}
                rowKey={(record) => `${record.id}`}
                dispatchType="weCom/fetchSearchOrganizationAdmin"
                {...organizationAuthAdminList}
            ></TableDataBlock>


        </Modal>
    );
};

export default connect(({ weCom, loading }) => ({
    ...weCom,
    loading: loading.models.weCom || loading.models.subscriber,
}))(LookAdmin);
